/**
 * @author shaosong
 * @description
 */
import React from 'react'
import { User } from '@nextui-org/react'
import { useRouter } from 'next/navigation'

export class UserProps {
  collapsed?: boolean
}

const UserMemo: React.FC<UserProps> = props => {
  const { push } = useRouter()
  return React.useMemo(
    () => (
      <User
        className="cursor-pointer"
        onClick={() => push('/dashboard')}
        name={!props.collapsed && '后台管理系统'}
        avatarProps={{
          src: 'https://pic.imgdb.cn/item/66729435d9c307b7e9620dda.png'
        }}
      />
    ),
    [props.collapsed]
  )
}

export default UserMemo
